let graph = {
  nodes: [{name: '成都', category: 0}, {name: '上海', category: 1}, {name: '北京', category: 1},
    {name: '深圳', category: 1}, {name: '广州', category: 1}],
  links: [{source: 0, target: 1}, {source: 1, target: 2}, {source: 2, target: 0}, {source: 0, target: 3},
    {source: 0, target: 4}, {source: 0, target: 5}
  ]
};
let groups = graph.nodes.reduce((a, b) => { if (!(b.category in a)) a[b.category] = 1; return a; }, {});
let categories = graph['categories'] || Object.keys(groups).map((d) => ({'name': '类' + d}));

export let option = {
  title: {
    text: '人才流动',
    top: 'bottom',
    left: 'right'
  },
  color: ['#f0f', '#0ff', '#00f', '#0f0'],
  tooltip: {},
  legend: [{
    // selectedMode: 'single',
    data: categories,
    show: false
  }],
  animationDurationUpdate: 1500,
  animationEasingUpdate: 'quinticInOut',
  series: [
    {
      name: '流动',
      type: 'graph',
      layout: 'circular',
      circular: {
        rotateLabel: true
      },
      data: graph.nodes,
      links: graph.links,
      categories: categories,
      roam: true,
      label: {
        normal: {
          show: true,
          position: 'right',
          formatter: '{b}',
          color: '#06f'
        }
      },
      lineStyle: {
        normal: {
          color: 'source',
          curveness: 0.3
        }
      }
    }
  ]
};

export const name = 'graph2';
